{extend name="admin/base" /}
{block name="resources"/}
<link rel="stylesheet" type="text/css" href="ADMIN_CSS/defau.css">
<script src="ADMIN_JS/art_dialog.source.js"></script>
<script src="ADMIN_JS/iframe_tools.source.js"></script>
<script src="ADMIN_JS/material_managedialog.js"></script>
{/block}
{block name="main"}
<input type="hidden" id="withdraw_id" value="{$list['id']}">
<div class="set-style">
	<dl>
		<dt>最低提现金额:</dt>
		<dd>
			<input id="cash_min" type="number" min="0.00"  value="{$list['value']['withdraw_cash_min']}" /><span class="withdraw_rule" id="verification_cash">提现金额不能为空</span>
			<p class="hint">提现金额将不小于此值才能提现</p>
		</dd>
	</dl>
	<dl>
		<dt>提现倍数:</dt>
		<dd>
			<input id="multiple" type="number" min="0.00"  value="{$list['value']['withdraw_multiple']}" /><span class="withdraw_rule" id="verification_multiple">提现倍数不能为空</span>
		</dd>
	</dl>
	<!-- <dl>
		<dt>提现手续费比例:</dt>
		<dd>
			<input id="poundage" type="number" min="0.00" step="0.01"  value="{$list['value']['withdraw_poundage']}" />&nbsp;%<span class="withdraw_rule" id="verification_poundage">提现手续费不能为空</span>
			<p class="hint">为0表示不收手续费</p>
		</dd>
	</dl> -->
	<dl>
		<dt>提现提示信息:</dt>
		<dd>
			<textarea name="store_zy" rows="2" id="message"
				class="textarea w400" maxlength="50">{$list['value']['withdraw_message']}</textarea><span class="withdraw_rule" id="verification_message">提现提示信息不能为空</span>
		</dd>
	</dl>
	<dl>
		<dt>是否启用</dt>
		<dd>
			<div class="controls">
				<label class="radio inline"><input type="radio" name="enable" value="1" checked="checked" id="enableYes">启用</label> 
				<label class="radio inline"><input type="radio" name="enable" value="0" checked="checked" id="enableNo">禁用</label>
				<input type="hidden" id="is_open" value="{$list['is_use']}">
			</div>
			<p class="hint">是否启用提现设置</p>
		</dd>
	</dl>
	<button class="edit_button" onclick="setMemberwithdrawAjax();">提交</button>
</div>
<script src="ADMIN_JS/ajax_file_upload.js" type="text/javascript"></script>
<script src="__STATIC__/js/file_upload.js" type="text/javascript"></script>
<script>

var validation = true;//验证余额输入
$("#poundage").live("keyup",function(){
	var reg = /^\d+(.{0,1})(\d{0,2})$/;
	if(!reg.test($(this).val())){
		showTip("请输入大于0的数字，并且保留两位小数","warning");
		validation = false;
	}else{
		validation = true;
	}
})
	function setMemberwithdrawAjax() {
		var is_use = $("input[type='radio'][name='enable']:checked").val();
		var cash_min = $("#cash_min").val();
		var multiple = $("#multiple").val();
		// var poundage = $("#poundage").val();
		var poundage = 0;
		var message = $("#message").val();
		if(!(cash_min>0)){
			$("#cash_min").focus();
			showTip("最低提现金额必须大于0","warning");
			return false;
		}
		
		if(!(/^\+?[1-9]\d*$/).test(multiple)){
			$("#multiple").focus();
			showTip("提现倍数必须大于0的整数","warning");
			return false;
		}
		if(validation){
			$.ajax({
				type : "post",
				url : "ADMIN_MAIN/config/memberwithdrawsetting",
				data : {
					'cash_min' : cash_min,
					'multiple' : multiple,
					'poundage' : poundage,
					'message' : message,
					'is_use' : is_use
				},
				success : function(data) {
					//alert(JSON.stringify(data));
					if (data['code'] > 0) {
						showMessage('success',"提交成功");
					} else {
						showMessage('error',"提交失败");
					}
				}
			});
		}else{
			showTip("请输入大于0的数字，并且保留两位小数","warning");
		}
	}
	window.onload=function(){
		var is_open = $("#is_open").val();
		if(is_open == ''){
			is_open = 0;
		}
		if(parseInt(is_open) == 0){
			$("#enableNo").prop("checked","checked");
		}else{
			$("#enableYes").prop("checked","checked");
		}
	}
</script>
{/block}